<?php

namespace Modules\Web\Http\Controllers;

use HiCommon\Service\OrderCheckpointService;
use HiCommon\Service\ProtocolService;
use HiCommon\Service\ShopService;
use Illuminate\Support\Facades\Request;

class IndexController extends BaseController
{

    /**
     * 首页数据-商户端
     *
     * @return array|void
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function index()
    {
        try {
            $n_shop_id = intval(get_web_shop_id());
            $res = ShopService::api_shop_index($n_shop_id);
            return $res;
        } catch (\Exception $exception) {
            return hello_error('失败', [], $exception->getMessage());
        }
    }

    /**
     * 收益明细-商户端
     *
     * @return array|void
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function profit_index()
    {
        try {
            $arr_search = Request::input();
            $n_shop_id = intval(get_web_shop_id());
            $res = ShopService::api_app_shop_profit_index($n_shop_id, $arr_search);
            return $res;
        } catch (\Exception $exception) {
            return hello_error('失败', [], $exception->getMessage());
        }
    }


    /*入驻说明*/
    public function join_in_explain(){
        try {

            $result = ProtocolService::shop_join_in_explain();
            return $result;
        } catch (\Exception $exception) {
            return hello_error('失败', [], $exception->getMessage());
        }
    }

    /*签订协议*/
    public function sign_agreement(){
        try {

            $result = ProtocolService::shop_sign_agreement();
            return $result;
        } catch (\Exception $exception) {
            return hello_error('失败', [], $exception->getMessage());
        }
    }


//    public function checkpoint_index(){
//        try {
//            $arr_admin = web_user();
//            $n_shop_id = intval(get_web_shop_id());
//            $n_shop_type = intval($arr_admin->type);
//            $res = ShopService::api_shop_index($n_shop_id,$n_shop_type);
//            return  $res;
//        }
//        catch (\Exception $exception) {
//            return hello_error('失败',[],$exception->getMessage());
//        }
//    }
//
//    public function repairstore_index(){
//
//    }


}
